package servlet.member;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import bean.control.MemberMgr;
import bean.entity.Member;

@SuppressWarnings("serial")
public class ConfirmMemberServlet extends HttpServlet {
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		String memId = req.getParameter("id");
		Member mem;
		HttpSession session = req.getSession();
		
		MemberMgr.changeStateToNormal(Long.parseLong(memId));
		mem = MemberMgr.getMemberById(Long.parseLong(memId));
		session.setAttribute("memId", memId);
		session.setAttribute("stuName", mem.getName());
		resp.setHeader("Refresh", "5; URL=./index");
		req.getRequestDispatcher("./member/confirmMember.jsp").forward(req, resp);
	}
}
